<extend name="public@emptypage" />
<block name="content">
<div class="card">
	<div class="card-header card-header-primary">

    		<ul class="nav nav-tabs" data-tabs="tabs">
			<li class="nav-item">
				<a class="nav-link" href="{:url('link/index')}">{:lang('ADMIN_LINK_INDEX')}</a>
			</li>
			<li class="nav-item">
				<a class="nav-link" href="{:url('link/add')}">{:lang('ADMIN_LINK_ADD')}</a>
			</li>
		</ul>
	</div>
	<div class="row">
		<div class="col-md-12">
			<div class="card-body">
			
			    <form method="post" class="form-horizontal js-ajax-form margin-top-20" action="{:url('link/editPost')}">
			        <div class="form-group">
			            <label for="input-link_name" class="col-sm-2 control-label">名称<span class="form-required">*</span></label>
			            <div class="col-md-6 col-sm-10">
			                <input type="text" class="form-control" id="input-link_name" name="name" value="{$link.name}">
			            </div>
			        </div>
			        <div class="form-group">
			            <label for="input-link_url" class="col-sm-2 control-label">链接地址<span class="form-required">*</span></label>
			            <div class="col-md-6 col-sm-10">
			                <input type="text" class="form-control" id="input-link_url" name="url" value="{$link.url}">
			            </div>
			        </div>
			        <div class="form-group">
			            <label for="input-link_image" class="col-sm-2 control-label">图标</label>
			            <div class="col-md-6 col-sm-10">
			                <input type="text" class="form-control" id="input-link_image" name="image" value="{$link.image}">
			                <a href="javascript:uploadOneImage('图片上传','#input-link_image');">上传图片</a>
			            </div>
			        </div>
			        <div class="form-group">
			            <label for="input-target" class="col-sm-2 control-label">打开方式</label>
			            <div class="col-md-6 col-sm-10">
			                <select class="form-control" name="target" id="input-target">
			                    <foreach name="targets" item="vo">
			                        <php>$link_target_selected=$link['target']==$key?"selected='selected'":"";</php>
			                        <option value="{$key}" {$link_target_selected}>{$vo}</option>
			                    </foreach>
			                </select>
			            </div>
			        </div>
			        <div class="form-group">
			            <label for="input-link_description" class="col-sm-2 control-label">描述</label>
			            <div class="col-md-6 col-sm-10">
			                <textarea class="form-control" name="description"
			                          id="input-link_description">{$link.description}</textarea>
			            </div>
			        </div>
			        <div class="form-group">
			            <div class="col-sm-offset-2 col-sm-10">
			                <input type="hidden" name="id" value="{$link.id}">
			                <button type="submit" class="btn btn-primary js-ajax-submit">{:lang('SAVE')}</button>
			                <a class="btn btn-default" href="{:url('link/index')}">{:lang('BACK')}</a>
			            </div>
			        </div>
			    </form>

			</div>
		</div>
	</div>
</block>
<block name="script">

<script src="__STATIC__/js/admin.js"></script>

</block>